/*
 * Package il.ac.biu.cs.grossmm.test.FooProtocol
 * File Activities.java
 * 
 * This is a part of presence service framework API. 
 * See javadoc for more information.
 *  
 * Copyright (C) 2006 Grossmann Mark
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package il.ac.biu.cs.grossmm.foo.format;

import java.util.Collection;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Set;

public class Activities implements Set<Activity>{
	EnumSet<Activity> set;
	
	public Activities(Activity...activities) { 
		set = EnumSet.noneOf(Activity.class);
		for( Activity activity : activities )
			set.add(activity);
	}
	
	Activities(Activities a, Activities b) {
		set = EnumSet.noneOf(Activity.class);
		set.addAll(a);
		set.addAll(b);
	}
	
	public Activities(EnumSet<Activity> activities) {
		set = activities.clone();
	}

	
	public boolean add(Activity o)
	{
		throw new UnsupportedOperationException();
	}

	public boolean addAll(Collection<? extends Activity> c)
	{
		throw new UnsupportedOperationException();
	}

	public void clear()
	{
		throw new UnsupportedOperationException();
	}

	public boolean contains(Object o)
	{
		return set.contains(o);
	}

	public boolean containsAll(Collection<?> c)
	{
		return set.contains(c);
	}

	public boolean isEmpty()
	{
		return set.isEmpty();
	}

	public Iterator<Activity> iterator()
	{
		return set.iterator(); // unmod. iterator shd. be used
	}

	public boolean remove(Object o)
	{
		throw new UnsupportedOperationException();
	}

	public boolean removeAll(Collection<?> c)
	{
		throw new UnsupportedOperationException();
	}

	public boolean retainAll(Collection<?> c)
	{
		throw new UnsupportedOperationException();
	}

	public int size()
	{
		return set.size();
	}

	public Object[] toArray()
	{
		return set.toArray();
	}

	public <T> T[] toArray(T[] a)
	{
		return set.toArray(a);
	}
	
	@Override
	public String toString()
	{
		return set.toString();
	}
	
	@Override
	public int hashCode()
	{
		return set.hashCode();
	}
	
	@Override
	public boolean equals(Object obj)
	{
		if( obj == null )
			return false;
		
		if(! ( obj instanceof Activities) )
			return false;
		
		if( obj == this )
			return true;
		
		Activities a = (Activities) obj;
		
		return set.equals(a.set);
	}
}
